home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
- Begin VB.Form frmSelFnt
- AutoRedraw = -1 'True
- BorderStyle = 3 'Fixed Dialog
- Caption = "Select Font"
- ClientHeight = 4512
- ClientLeft = 48
- ClientTop = 336
- ClientWidth = 4428
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4512
- ScaleWidth = 4428
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 'CenterScreen
- Begin MSComDlg.CommonDialog c
- Left = 30
- Top = 3000
- _ExtentX = 847
- _ExtentY = 847
- _Version = 327681
- CancelError = -1 'True
- End
- Begin VB.ComboBox cboColor
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 7.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 315
- ItemData = "SelFnt.frx":0000
- Left = 2280
- List = "SelFnt.frx":002E
- Style = 2 'Dropdown List
- TabIndex = 12
- Top = 3360
- Width = 1455
- End
- Begin VB.ListBox lstSize
- Height = 2400
- IntegralHeight = 0 'False
- ItemData = "SelFnt.frx":00B5
- Left = 3120
- List = "SelFnt.frx":00E3
- TabIndex = 10
- Top = 600
- Width = 1155
- End
- Begin VB.TextBox txtFontSize
- Height = 285
- Left = 3120
- Locked = -1 'True
- TabIndex = 9
- Text = "8"
- Top = 270
- Width = 1155
- End
- Begin VB.ListBox lstStyle
- Height = 2400
- IntegralHeight = 0 'False
- ItemData = "SelFnt.frx":011D
- Left = 1920
- List = "SelFnt.frx":012D
- MultiSelect = 2 'Extended
- TabIndex = 8
- Top = 600
- Width = 1155
- End
- Begin VB.TextBox txtPrev
- Appearance = 0 'Flat
- Height = 315
- Left = 720
- TabIndex = 5
- Text = "Aa Bb Cc"
- Top = 3360
- Width = 1455
- End
- Begin VB.PictureBox pPrev
- Appearance = 0 'Flat
- AutoRedraw = -1 'True
- BackColor = &H00808080&
- ForeColor = &H80000008&
- Height = 615
- Left = 720
- ScaleHeight = 588
- ScaleWidth = 2508
- TabIndex = 3
- Top = 3870
- Width = 2535
- End
- Begin VB.ListBox lstFonts
- Height = 2400
- IntegralHeight = 0 'False
- Left = 60
- TabIndex = 2
- Top = 600
- Width = 1815
- End
- Begin VB.TextBox txtFontName
- Height = 285
- Left = 60
- TabIndex = 1
- Text = "MS Sans Serif"
- Top = 270
- Width = 1815
- End
- Begin VB.TextBox txtStyle
- Height = 285
- Left = 1920
- Locked = -1 'True
- TabIndex = 7
- Text = "Regular"
- Top = 270
- Width = 1155
- End
- Begin VB.Label Label4
- AutoSize = -1 'True
- Caption = "Color:"
- Height = 195
- Left = 2310
- TabIndex = 11
- Top = 3120
- Width = 405
- End
- Begin VB.Label Label3
- AutoSize = -1 'True
- Caption = "Preview Text:"
- Height = 195
- Left = 750
- TabIndex = 6
- Top = 3120
- Width = 975
- End
- Begin VB.Label Label2
- AutoSize = -1 'True
- Caption = "Preview:"
- Height = 195
- Left = 750
- TabIndex = 4
- Top = 3660
- Width = 615
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "Font &Name:"
- Height = 195
- Left = 60
- TabIndex = 0
- Top = 60
- Width = 825
- End
- Attribute VB_Name = "frmSelFnt"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Public oFont As StdFont
- Public xFont As StdFont
- Public Color As Long
- Private ActivatedBefore As Boolean
- Private WithEvents cmdOK As ComboPack.Button
- Attribute cmdOK.VB_VarHelpID = -1
- Private WithEvents cmdCancel As ComboPack.Button
- Attribute cmdCancel.VB_VarHelpID = -1
- Private Sub cboColor_Click()
- If cboColor.ListIndex = -1 Then Exit Sub
- Select Case LCase(cboColor.List(cboColor.ListIndex))
- Case "yellow"
- pPrev.ForeColor = RGB(255, 255, 0)
- Case "blue"
- pPrev.ForeColor = RGB(0, 0, 255)
- Case "custom..."
- Load frmColorSelector
- frmColorSelector.Color = pPrev.ForeColor
- frmColorSelector.SetColor frmColorSelector.Color
- DoUntilNotVisible frmColorSelector
- pPrev.ForeColor = frmColorSelector.Color
- Unload frmColorSelector
- Case "red"
- pPrev.ForeColor = RGB(255, 0, 0)
- Case "green"
- pPrev.ForeColor = RGB(0, 255, 0)
- Case "white"
- pPrev.ForeColor = RGB(255, 255, 255)
- Case "dark blue"
- pPrev.ForeColor = RGB(0, 0, 128)
- Case "dark grey"
- pPrev.ForeColor = RGB(72, 72, 72)
- Case "dark green"
- pPrev.ForeColor = RGB(0, 128, 0)
- Case "dark yellow"
- pPrev.ForeColor = RGB(128, 128, 0)
- Case "dark red"
- pPrev.ForeColor = RGB(128, 0, 0)
- Case "black"
- pPrev.ForeColor = RGB(0, 0, 0)
- Case "grey"
- pPrev.ForeColor = RGB(128, 128, 128)
- Case "system color..."
- 'TO DO
- End Select
- cboColor.ForeColor = pPrev.ForeColor
- End Sub
- Private Sub cmdCancel_Click()
- Unload Me
- End Sub
- Private Sub cmdCancel_Press()
- cmdCancel.HasFocus = True
- cmdOK.HasFocus = False
- End Sub
- Private Sub cmdOK_Click()
- Set oFont = New StdFont
- With oFont
- .Size = pPrev.Font.Size
- .Bold = pPrev.Font.Bold
- .Italic = pPrev.Font.Italic
- .Underline = pPrev.Font.Underline
- .Name = pPrev.Font.Name
- End With
- Unload Me
- Hide
- End Sub
- Private Sub cmdOK_Press()
- cmdCancel.HasFocus = False
- cmdOK.HasFocus = True
- End Sub
- Private Sub Form_Load()
- Set cmdOK = New ComboPack.Button
- Set cmdOK.Parent = frmSelFnt
- cmdOK.Left = 3310
- cmdOK.Top = 3860
- cmdOK.Height = 300
- cmdOK.Width = 1065
- cmdOK.ForeColor = 0
- cmdOK.Name = "cmdOK"
- cmdOK.Enabled = True
- cmdOK.Caption = "OK"
- cmdOK.BackColor = -2147483633
- cmdOK.Redraw
- Set cmdCancel = New ComboPack.Button
- Set cmdCancel.Parent = frmSelFnt
- cmdCancel.Left = 3310
- cmdCancel.Top = 4180
- cmdCancel.Height = 300
- cmdCancel.Width = 1065
- cmdCancel.ForeColor = 0
- cmdCancel.BackColor = -2147483633
- cmdCancel.Name = "cmdCancel"
- cmdCancel.Enabled = True
- cmdCancel.Caption = "Cancel"
- cmdCancel.Redraw
- End Sub
- Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
- cmdOK.MouseDown Button, X, Y
- cmdCancel.MouseDown Button, X, Y
- End Sub
- Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- cmdOK.MouseMove Button, X, Y
- cmdCancel.MouseMove Button, X, Y
- End Sub
- Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
- cmdOK.MouseUp Button, X, Y
- cmdCancel.MouseUp Button, X, Y
- End Sub
- Private Sub Form_Activate()
- If ActivatedBefore Then Exit Sub
- ActivatedBefore = True
- Dim Font As Long
- If xFont Is Nothing Then Unload Me: Exit Sub
- For Font = 0 To Screen.FontCount - 1
- lstFonts.AddItem Screen.Fonts(Font)
- Next
- txtFontName = xFont.Name
- SelectInList lstFonts, txtFontName
- SelectInList lstStyle, txtStyle
- txtFontSize = xFont.Size \ 1 'Just in case the _
- font is something like 8.5, It has happened...
- SelectInList lstSize, txtFontSize
- lstStyle.ListIndex = 0
- lstStyle.Selected(0) = True
- If xFont.Bold Then
- lstStyle.Selected(0) = False
- lstStyle.Selected(1) = True
- End If
- If xFont.Italic Then
- lstStyle.Selected(0) = False
- lstStyle.Selected(2) = True
- End If
- If xFont.Underline Then
- lstStyle.Selected(0) = False
- lstStyle.Selected(3) = True
- End If
- End Sub
- Public Sub SelectInList(ListBox As ListBox, TextBox As TextBox)
- If TextBox = "" Then Exit Sub
- Dim m_lngLoop As Long
- For m_lngLoop = 0 To ListBox.ListCount - 1
- If LCase(ListBox.List(m_lngLoop)) = LCase(TextBox) Then
- ListBox.ListIndex = m_lngLoop
- End If
- PrintPreview
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- ActivatedBefore = False
- End Sub
- Private Sub lstFonts_Click()
- txtFontName = lstFonts.List(lstFonts.ListIndex)
- End Sub
- Private Sub lstSize_Click()
- txtFontSize = lstSize.List(lstSize.ListIndex)
- SelectInList lstSize, txtFontSize
- End Sub
- Private Sub lstStyle_Click()
- Dim m_lngLoop As Long
- txtStyle = ""
- For m_lngLoop = 0 To lstStyle.ListCount - 1
- If lstStyle.Selected(m_lngLoop) Then
- txtStyle = txtStyle & lstStyle.List(m_lngLoop) & " "
- End If
- Next
- If lstStyle.Selected(0) Then
- For m_lngLoop = 1 To lstStyle.ListCount - 1
- lstStyle.Selected(m_lngLoop) = False
- Next
- End If
- If lstStyle.Selected(1) Then
- pPrev.FontBold = True
- Else
- pPrev.FontBold = False
- End If
- If lstStyle.Selected(2) Then
- pPrev.FontItalic = True
- Else
- pPrev.FontItalic = False
- End If
- If lstStyle.Selected(3) Then
- pPrev.FontUnderline = True
- Else
- pPrev.FontUnderline = False
- End If
- PrintPreview
- End Sub
- Private Sub txtFontName_Change()
- If txtFontName = "" Then Exit Sub
- SelectInList lstFonts, txtFontName
- End Sub
- Public Sub PrintPreview()
- pPrev.Cls
- pPrev.FontName = lstFonts.List(lstFonts.ListIndex)
- pPrev.FontSize = txtFontSize
- pPrev.CurrentX = pPrev.Width / 2 - pPrev.TextWidth(txtPrev) / 2
- pPrev.CurrentY = pPrev.Height / 2 - pPrev.TextHeight(txtPrev) / 2
- pPrev.Print txtPrev
- End Sub
- Private Sub txtPrev_Change()
- PrintPreview
- End Sub
- Private Sub UpdateCombo()
- Select Case Color
- 'To Do
- End Select
- End Sub
-